<div>
    <br>
    <ol class="breadcrumb">
        <li class="active"><span class="glyphicon glyphicon-home" style="color:#23527c"></span>&nbsp;<mainpage></mainpage></li>
        <li class="active">监控工作台 / 监控配置</li>
    </ol>
    <ul class="nav nav-tabs marT15">
      <li role="presentation"><a href="#/objManage" style="color: #555;">对象管理</a></li>
      <li role="presentation"><a href="#/childObjManage" style="color:#555;">子对象管理</a></li>
      <li role="presentation"><a href="#/attributeManage" style="color: #555;">属性管理</a></li>
      <li role="presentation" class="active"><a href="#/setupManage" style="color:#555;">监控设置管理</a></li>
      <li role="presentation"><a href="#/warnPersonManage" style="color: #555;">预警人管理</a></li>
      
   </ul> 
    <div class="form-inline">
        <div class="control-group row marB15" style="margin-left: 0px">
            <div class="left marT15 marR10">
                <span class="search-name">对象类型</span>
                <select class="form-control1" 
                ng-model='searchData.objType'
                ng-change='childObjType("searchData")'
                ng-keyup='search($event)'
                >  
                  <option value="">全部</option>
                  <option value="{{item.DICVALUE}}" ng-repeat='item in objtypeList'>{{item.DICVALUENAME}}</option>                 
                </select>
            </div>            
            <div class="left marT15 marR10">
                <span class="search-name">对象</span>
                <select class="form-control1" 
                ng-change='getKeyName("searchData")'
                ng-model='searchData.objId'>
                    <option value="">全部</option>
                    <option value="{{item.objId}}" ng-repeat='item in objList'>{{item.objName}}</option> 
                </select>
            </div>
            <div class="left marT15 marR10">
                <span class="search-name">子对象</span>
                <select class="form-control1" ng-model='searchData.itemId'>
                    <option value="">全部</option>
                    <option value='{{item.itemId}}' ng-repeat='item in keyNameList'>{{item.itemName}}</option>
                </select>
            </div>
            <a class=" btn btn-primary btn-sm left marT15" ng-click='search()'><span class="glyphicon glyphicon-search"></span></a>

        </div>
        </form>


      <div class="table-box">

        <table class="table table-bordered table-striped text-center bg-info">
            <thead >
            <tr class="info">
                <th class="text-center">监控ID</th>
                <th class="text-center">属性名称</th>
                <th class="text-center">监控阀值上限</th>
                <th class="text-center">监控阀值下限</th>
                <th class="text-center">监控表达式</th>
                <th class="text-center">异常时长(秒)</th>
                <th class="text-center">异常次数(次)</th>
                <th class="text-center">预警等级</th>
                <th class="text-center">短信预警</th>
                <th class="text-center">邮件预警</th>
                <th class="text-center">预警信息模板</th>
                <th class="text-center">预警说明</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat='item in result'>
                <td class="w85">{{item.triggerId}}</td>
                <td class="w85">{{item.keyNameCn}}</td>
                <td class="w85">{{item.upperLimit}}</td>
                <td class="w115">{{item.lowerLimit}}</td>
                <td class="w115">{{item.expressions}}</td>
                <td class="w115">{{item.sustainTime}}</td>
                <td class="w85">{{item.times}}</td>
                <td class="w85">{{item.alarmLevel}}</td>
                <td class="w85">
                  <span ng-show='item.smFlag=="1"'>需短信预警</span>
                  <span ng-show='item.smFlag=="0"'>不需短信预警</span></td>
                <td class="w85">
                  <span ng-show='item.emailFlag=="1"'>需邮件预警</span>
                  <span ng-show='item.emailFlag=="0"'>不需邮件预警</span>
                </td>
                <td class="w85">{{item.warnMsg}}</td>
                <td class="w85">{{item.indexDesc}}</td>    
                <td class="w85">
                    <a class="marR10" data-toggle="modal" ng-click="edit('修改',item.triggerId)" data-target="#add1">修改</a>
                    <a data-toggle="modal" data-target="#delete" ng-click='delete(item.triggerId)'>删除</a>
                </td>

            </tr>
            <tr>
                <td><a class="glyphicon glyphicon-plus" data-toggle="modal" ng-click="edit('添加')" data-target="#add1"></a></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>

            </tbody>
        </table>
    </div>
        <page></page>
    </div>


<!--添加程序弹窗-->
<div class="modal fade" id="add1" tabindex="-1" role="dialog" aria-labelledby="add11">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="add11">{{popup}}对象</h4>
            </div>
            <div class="modal-body">
                <div class="row marB15 lineH25">
                
		            <div class="col-xs-6" ng-if='isDisable==true'>
		                <span class="search-name">对象类型</span>
		                <select class="form-control line4 right"
		                ng-model='addData.objType'
		                ng-change='childObjType("addData")'
		                ng-keyup='search($event)'
		                >  
		                  <option value="">全部</option>
		                  <option value="{{item.DICVALUE}}" ng-repeat='item in objtypeList'>{{item.DICVALUENAME}}</option>                 
		                </select>
		            </div>
		            <div class="col-xs-6" ng-if='isDisable==false'>
		                <span class="search-name">对象类型</span>
		                <select class="form-control line4 right"
		                ng-model='addData.objType'
		                ng-change='childObjType("addData")'
		                ng-keyup='search($event)' disabled='true'
		                >  
		                  <option value="">全部</option>
		                  <option value="{{item.DICVALUE}}" ng-repeat='item in objtypeList'>{{item.DICVALUENAME}}</option>                 
		                </select>
		            </div>                 
                    <div class="col-xs-6" ng-if='isDisable==true'>
                            <label class="left">对象</label>
                            <select class="form-control line4 right" 
                            ng-change='getKeyName("addData")'
                            ng-options='item.objId as item.objName for item in objList1'
                            ng-model='addData.objId'>
                            </select>
                    </div>
                    <div class="col-xs-6" ng-if='isDisable==false'>
                            <label class="left">对象</label>
                            <select class="form-control line4 right" 
                            ng-change='getKeyName("addData")'
                            ng-options='item.objId as item.objName for item in objList1'
                            ng-model='addData.objId' disabled='true'>
                            </select>
                    </div>
                </div>
                <div class="row marB15 lineH25">
                     
                    
                    <div class="col-xs-6" ng-if='isDisable==true'>
                            <label class="left">子对象</label>
                            <select class="form-control line4 right" 
                            ng-options='item.itemId as item.itemName for item in keyNameList1'
                            ng-change='getIndexUnit()'
                            ng-model='addData.itemId'>
                               
                            </select>
                    </div>
                     <div class="col-xs-6" ng-if='isDisable==false'>
                            <label class="left">子对象</label>
                            <select class="form-control line4 right" 
                            ng-options='item.itemId as item.itemName for item in keyNameList1'
                            ng-change='getIndexUnit()'
                            ng-model='addData.itemId' disabled='true'>
                               
                            </select>
                    </div>
                    <div class="col-xs-6" ng-if='isDisable==false'>
                            <label class="left">属性</label>
                            <select class="form-control line4 right" ng-options='item.keyId as item.keyName for item in indexUnitList' ng-model='addData.keyId' disabled='true'>                                
                            </select>
                    </div>
                    <div class="col-xs-6" ng-if='isDisable==true'>
                            <label class="left">属性</label>
                            <select class="form-control line4 right" ng-options='item.keyId as item.keyName for item in indexUnitList' ng-model='addData.keyId'>                                
                            </select>
                    </div>
                </div>
                <div class="row marB15 lineH25">
                    
                    <div class="col-xs-6">
                            <label class="left">预警级别</label>
                           <select class="form-control line4 right" ng-model='addData.alarmLevel' name='alarmLevel'> <!-- ng-options='item.value as item.leval for item in warmlevalList' -->
                                <!--  <option value=''>{{  item.value}}</option> -->
                                <option value=''>--请选择--</option>
                                <option value='1'>一级</option>
                                <option value='2'>二级</option>
                                <option value='3'>三级</option> 
                               <!--  <option value="{{item.value}}" ng-repeat='item in warmlevalList'>{{item.leval}}</option> -->
                            </select>
                    </div>
                     <div class="col-xs-6">
                            <label class="left">异常次数</label>
                            <label class="right marL10">次</label>
                            <input type="text"  onkeyup='this.value=this.value.replace(/\D/g,"")' ng-model='addData.times' class="form-control line4 right input" style="width: 128px">
                    </div>
                   
                </div>
                 
                <div class="row marB15 lineH25">
                   
                    <div class="col-xs-6 ">
                            <label class="left">监控表达式</label>
                            <input type="text" ng-model='addData.expressions' class="form-control line4 right"> 
                    </div>
                    <div class="col-xs-6">
                            <label class="left">持续时长</label>
                            <label class="right marL10">秒</label>
                            <input type="text" 
                            onkeyup='this.value=this.value.replace(/\D/g,"")'
                            ng-model='addData.sustainTime'
                            class="form-control line4 right input" style="width: 128px;">                          
                    </div>
                   
                </div>
                <div class="row marB15 lineH25">
                    
                    
                     <div class="col-xs-6">
                         <div class="row">
                             <div class="col-xs-6">
                                 <label class="left">阀值上限</label>
                                 <input type="text" 
                                 ng-model='addData.upperLimit'
                                 class="form-control line4 right input" 
                                 onkeyup='this.value=this.value.replace(/\D/g,"")'
                                 style="width: 50px;">
                             </div>
                             <div class="col-xs-6" style="padding-right: 0px!important;">
                                 <label class="left marL15">阀值下限</label>
                                 <input type="text" 
                                 ng-model='addData.lowerLimit'
                                 class="form-control line4 right input" 
                                 onkeyup='this.value=this.value.replace(/\D/g,"")'
                                 style="width: 50px;">
                             </div>
                         </div>
                            
                    </div>
                </div>
                <div class="row marB15 lineH25">
                    <div class="col-xs-2">
                         <label>预警方式</label>                     
                    </div>
                   <div class="col-xs-2">
                       <input type="checkbox"
                        ng-model='addData.emailFlag'
                        style="vertical-align: text-bottom;" class='input'><span>&nbsp;邮件</span>
                   </div>
                   <div class="col-xs-2">
                       <input type="checkbox" 
                        ng-model='addData.smFlag'
                        style="vertical-align: text-bottom;" class='input'><span>&nbsp;短信</span>
                   </div>
                </div>
                <div class="marT15 clearfix row">
                    <div class="col-xs-12">
                        <p><label>预警信息模板 ：</label></p>
                        <textarea class="form-control"  ng-model='addData.warnMsg' id="desc1" ></textarea>
                        <p class="marT15" style="color:red">模板可使用变量，变量格式${var}，支持变量：阀值下限：valve_min,上限valve_max，指标值index，预警等级level，持续时长 long，异常次数 times等。</p>
                    </div>
                </div>
                <div class="marT15 clearfix row">
                    <div class="col-xs-12">
                        <label class="left"><span>监控说明 ：</span></label>
                        <textarea class="left form-control" ng-model='addData.indexDesc' id="desc"></textarea>
                    </div>
                </div>
                <br>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary btn-sm" ng-click='editSave()'>保存</button>
            </div>
        </div>
    </div>
</div>
<!-- 添加程序结束 -->

<div class="modal fade" id="delete">  
  <div class="modal-dialog">  
    <div class="modal-content message_align">  
      <div class="modal-header">  
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>  
        <h4 class="modal-title">提示信息</h4>  
      </div>  
      <div class="modal-body">  
        <p>此操作将会连同监控异常事件信息一并删除，您确认要删除吗？</p>  
      </div>  
      <div class="modal-footer">  
         <input type="hidden" id="url"/>  
         <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>  
         <a id="deleteSure" class="btn btn-primary" data-dismiss="modal" ng-click="deleteTr()">确定</a>  
      </div>  
    </div><!-- /.modal-content -->  
  </div><!-- /.modal-dialog -->  
</div><!-- /.modal -->  
<!-- 加载框 -->
  <span class='loaded' ng-show='loaded'><img  src="img/load.gif"></span>
<!-- 加载框 完成-->
